@extends('admin.author.layout.layout')
@section('content')
<div class="panel panel-default">
    <div class="panel-heading" style="padding-bottom:0px">
        
        <div class="row">
            <div class="col-lg-5">
                <h4>书籍列表</h4>
            </div>
            <div class="col-lg-5 col-lg-offset-2">

            <form action="{{url('/admin/article/indexh')}}" method="get">
                <div class="form-group input-group">
                    <span class="input-group-addon">搜索书籍</span>
                    <!-- <input type="text" class="form-control"> -->
                    <select name="sid" class="form-control">
                        <option value="">全部</option>
                        @foreach($books as $k=>$v)
                            <option value="{{$v->id}}" @if($sid == $v -> id)
                                                          selected  
                                                       @endif>{{$v->b_name}}</option>
                        @endforeach
                    </select>
                    <span class="input-group-btn">
                        <button class="btn btn-default" type="submit"><i class="fa fa-search"></i>
                        </button>
                    </span>
                </div>
            </form>

            </div>    
        </div>
    </div>
    <!-- /.panel-heading -->
    <div class="panel-body">
        <div class="table-responsive">
            @if(session('success'))
            <div class="alert alert-success">
                {{session('success')}}
            </div>    
            @endif
            <table class="table table-striped table-bordered table-hover">
                <thead>
                    <tr>
                        <th  style="text-align:center;">ID</th>
                        <th  style="text-align:center;">书籍名称</th>
                        <th  style="text-align:center;">文章名称</th> 
                        <th  style="text-align:center;">是否免费</th>
                        <th  style="text-align:center;">审核状态</th>
                        <th  style="text-align:center;">操作</th>
                    </tr>
                </thead>
                <tbody>
                @foreach($articles as $k=>$v)
                    <tr style="text-align:center;">
                        <td>{{$v->id}}</td>
                        <td>{{$v->b_name}}</td>
                        <td>{{$v->title}}</td>
                        <td>
                            @if($v->isfree == 0)
                                免费
                            @else
                                收费    
                            @endif
                        </td>
                        <td>
                            @if($v->status == 0)
                                等待审核
                            @elseif($v->status == 1)
                                审核通过   
                            @else
                                审核未通过    
                            @endif
                        </td>
                        <td>
                        @if($v->status == 0 ||$v->status == 2)
                            <a href="{{url('/admin/article/edit',['id'=>$v->session('id')])}}">编辑</a>
                        @else
                            <a href="javascript:void(0);" style="color:#898C7D;cursor:no-drop">编辑</a>
                        @endif
                        
                        </td>
                    </tr>
                @endforeach    
                </tbody>
            </table>
        </div>
        {!! $articles->appends(['sid' => $sid])->render() !!}
        <!-- /.table-responsive -->
    </div>
    <!-- /.panel-body -->
</div>

@endsection